/**
 * @file
 * @author  RR42 <im.razzy@gmail.com>
 * @version 0.1a
 *
 * @section LICENSE
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details at
 * http://www.gnu.org/copyleft/gpl.html
 *
 * @section DESCRIPTION
 *
 * This is an utility for GTK+2 su frontend:
 * It controls virtual termainal with su.
 * And doesn't waste the space for GTK. 
 * 
 * @section INPUT
 * 
 * It takes 1 argument: pid of su. (it is what TODO)
 */

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>

//FIXME: program does not check the arguments
int main (int argc, char *argv[]) {
    int fd = atoi(argv[1]);
    char buf[256];
    buf[255] = 0;
    while (1) {
        if (read(fd, buf, 255) <= 0) break;
        fprintf(stderr, "%s", buf);// Так сделано в GkSu...
    }
    return 0;
}
